package com.itly.rwgh.utils;

import com.itly.rwgh.pojo.DataModel;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: 罗言
 * @Version: 1.0
 * @Date: 2023-12-26-18:02
 * @Description: 定制专用冒泡排序
 */
public class BubbleSort {

    public static List<DataModel> sort(List<DataModel> param) {
        DataModel temp = null;
        for (int i = 0; i < param.size() - 1; i++) {
            for (int j = 0; j < param.size() - i - 1; j++) {
                if (Integer.parseInt(param.get(j).getColumn2())
                        > Integer.parseInt(param.get(j + 1).getColumn2())) {
                    temp = param.get(j);
                    param.set(j, param.get(j + 1));
                    param.set(j + 1, temp);
                }
            }
        }
        return param;
    }
}
